<?php
set_time_limit(0); 
include '../c/config.php';

$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);

$checkList=['13061734405','13166113395','13262742079','13262807809','13311826029','13331999913','13370028858','13501631666','13501896354','13564105929','13585561449','13601742108','13611682455','13611798296','13636578520',
'13671947306','13671997956','13761048620','13761408227','13764218252','13795481637','13801915211'

];
$j=0;
$query=$mysqli->query("select phone from d5 WHERE id > 28500 group by phone having count(phone) >1 ");
while ($list=$query->fetch_array()) {
	 $phone=$list['phone'];

	 //echo $phone;
	 //echo "<br />";
     
     $queryD=$mysqli->query("select * from d5 WHERE phone ='".$phone."' ");
     $i=1;
     $a=array();
     $b=array();
     while ($listD=$queryD->fetch_array()) {
     	if (1 == $i) {
     	 	$a=array('createtime'=>$listD['createtime'],'dui'=>$listD['dui'],'yi'=>$listD['yi'],'id'=>$listD['id'],'er'=>$listD['er'],'san'=>$listD['san'], 'uid'=>$listD['uid']);
     	 } 

     	 if (1 <  $i) {
     	 	$b=array('createtime'=>$listD['createtime'],'dui'=>$listD['dui'],'yi'=>$listD['yi'],'id'=>$listD['id'],'er'=>$listD['er'],'san'=>$listD['san'], 'uid'=>$listD['uid']);
     	 }

        $i++;
     }


     if ($a['createtime'] == $b['createtime'] || $a['dui'] == $b['dui']) {
     	if (!in_array($phone, $checkList)) {
     		  echo "<br />";
     	     echo $j.'........yes...........',$phone;
               
               if ($a['yi'] == $b['yi'] && $a['er'] == $b['er'] && $a['san'] == $b['san'] && $a['uid'] == $b['uid']) {
                     echo "........",$b['id'];
                     echo "<br />";
                     $sql="update d5 set uid='".$a['uid']."-del', phone='".$phone."-del' where id='".$b['id']."' ";
                     echo $sql;
                     if($i < 4){
                         $mysqli->query($sql);
                     } 
                     echo "<br /><br />";

               }

     	     echo "<br />";


     	     $j++;
     	}
     	
     }
     
	 //SELECT * FROM `d3` WHERE `phone` LIKE '12482633906'


}

 